Skip to content

Drop ConstrainResult mode bit #9641

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 26, 2020

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Aug 25, 2020

Use a TypeComparer variable instead. This saves ~60K fresh contexts
on typer/*.scala, which is roughtly 10%. It's also cleaner since it
avoids a global mode bit.

Use a TypeComparer variable instead. This saves ~60K fresh contexts
on typer/*.scala, which is roughtly 10%. It's also cleaner since it
avoids a global mode bit.
Copy link
Contributor

@liufengyun liufengyun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

def necessarilyCompatible(tp: Type, pt: Type)(using Context): Boolean =
val tpw = tp.widenExpr
val ptw = pt.widenExpr
necessarySubType(tpw, ptw) || tpw.isValueSubType(ptw) || viewExists(tp, pt)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it matter?

Suggested change
necessarySubType(tpw, ptw) || tpw.isValueSubType(ptw) || viewExists(tp, pt)
necessarySubType(tpw, ptw) || tpw.isValueSubType(ptw) || viewExists(tpw, ptw)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would matter if there is an implicit conversion between singleton types. In this case it should be viewExists(tp, pt)

@odersky odersky merged commit 61512f1 into scala:master Aug 26, 2020
@odersky odersky deleted the drop-constrain-result branch August 26, 2020 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants